from jiuxian.Page1 import Page1
from jiuxian.Page2 import Page2
from selenium import webdriver
from jiuxian.Base import Base
from selenium.webdriver.common.by import By
import unittest
import time

class TestCase(unittest.TestCase):
    def setUp(self):
        self.driver=webdriver.Edge()
        self.driver.implicitly_wait(10)
        self.driver.maximize_window()

    def tearDown(self):
        time.sleep(10)
        self.driver.quit()


    def jiuxian_01(self):
        po=Page1(self.driver)
        po.open_url('https://www.jiuxian.com/')
        po.login()
        po.username()
        po.passward()
        time.sleep(10)
        po.dl()
        po.gb()
        # 断言用户
        text = self.driver.find_element(By.XPATH, '/html/body/div[2]/div/div[1]/div/p/span')
        assert 'jxw627748426' == text

    def jiuxian_02(self):
        po1=Page2(self.driver)
        po1.open_url('https://www.jiuxian.com/')
        po1.jiuxian()
        # 断言我的酒仙
        text = self.driver.find_element(By.XPATH, '/html/body/div[4]/div[1]/h1/a/span')
        assert '我的酒仙' == text
        po1.window()
        po1.scrollTo(800)
        po1.ts()
        po1.dz()
        po1.sc()
if __name__ == '__main__':
    unittest.main()

